package ooday03;

public class Test {
    public static void main(String[] args) {


        Dog[] dogs = new Dog[3];
        dogs[0] = new Dog("小红", 2, "红色");
        System.out.println(dogs[0].name);
        dogs[1] = new Dog("小白", 2, "白色");
        dogs[2] = new Dog("小黄", 3, "黄色");
        System.out.println(dogs[1].age);
        for (int i = 0; i < dogs.length; i++) {
            System.out.println(dogs[i].name);
            dogs[i].eat();
        }
        Chick[] chick = new Chick[2];
        chick[0] = new Chick("鸡", 1, "白色");
        chick[1] = new Chick("鸡仔", 1, "黄色");
        for (int i = 0; i < chick.length; i++) {
            System.out.println(chick[i].name);
            chick[i].layEggs();
        }
        Fish[] fish = new Fish[2];
        fish[0] = new Fish("小鲤鱼",1,"红色");
        fish[1] = null;//表示空,没有指向任何对象
     ///   System.out.println(fish[1].name);//语法不报错,但是不能访问



    }
}
